package com.zzy.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.zzy.domain.dto.WarehouseAreaPageDto;
import com.zzy.domain.po.WarehouseArea;
import com.zzy.domain.vo.PageResult;
import com.zzy.mapper.WarehouseAreaMapper;
import com.zzy.service.WarehouseAreaService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@RequiredArgsConstructor
@Service
public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper,WarehouseArea> implements WarehouseAreaService {
    private final WarehouseAreaMapper warehouseAreaMapper;


    @Override
    public PageResult getPage(WarehouseAreaPageDto dto) {


        Page<WarehouseArea>page=new Page<>(dto.getPage(),dto.getPageSize());
       IPage<WarehouseArea> result = warehouseAreaMapper.selectAreaPage(page,dto);
        return new PageResult<>(result.getTotal(),result.getRecords());

    }

    @Override
    public Integer removeBatchById(List<Long> ids) {

        return warehouseAreaMapper.deleteByIds(ids);
    }
}
